package com.gouwudai.gobbs.service.impl;

import java.util.List;

import org.extremecomponents.table.limit.Limit;

import com.gouwudai.gobbs.common.Constants;
import com.gouwudai.gobbs.common.IPageList;
import com.gouwudai.gobbs.dao.IContentFilterDAO;
import com.gouwudai.gobbs.pojo.TbbsContentFilter;
import com.gouwudai.gobbs.service.IContentFilterService;
import com.litt.core.util.ExtremeTableUtil;

public class ContentFilterServiceImpl implements IContentFilterService
{
	IContentFilterDAO contentFilterDAO;
	
	public void save(TbbsContentFilter tbbsContentFilter)
	{		
		contentFilterDAO.save(tbbsContentFilter);
	}

	public TbbsContentFilter load(Integer id)
	{
		return (TbbsContentFilter)contentFilterDAO.load(id);
	}

	public void update(TbbsContentFilter tbbsContentFilter)
	{
		contentFilterDAO.update(tbbsContentFilter);
	}

	public void delete(Integer cfId)
	{
		contentFilterDAO.delete(cfId);
	}

    public List listByType(int filterType)
    {
    	return contentFilterDAO.listByType(filterType);
    }
	
	public IPageList listPage(int pageIndex,int pageSize,String sort)
	{
		return contentFilterDAO.listPage(pageIndex, pageSize,sort);
	}
	
	public void AutoBindingTable(javax.servlet.http.HttpServletRequest request)
	{
		Limit limit = ExtremeTableUtil.getLimit(request, Constants.DEFAULT_PAGE_SIZE);
		IPageList page = this.listPage(limit.getPage(), limit.getCurrentRowsDisplayed(),ExtremeTableUtil.getSort(limit));
		request.setAttribute("resultList",page.getRsList());
		request.setAttribute("totalRows",page.getTotalSize());
	}

	public void setContentFilterDAO(IContentFilterDAO contentFilterDAO) {
		this.contentFilterDAO = contentFilterDAO;
	}

	
}